-
Notifications
You must be signed in to change notification settings - Fork 852
Quic pollcont, Reuse the NetHandler for UDP packet #3056
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
|
I could build this PR and complete handshake with ngtcp2 :) There're some TODOs, but this looks good. |
|
I got this crash when I try our quic client. |
iocore/net/QUICNet.cc
Outdated
| NetHandler *nh = get_NetHandler(this->mutex->thread_holding); | ||
|
|
||
| // Process the ASLL | ||
| SList(UDPPacketInternal, alink) aq(inQueue.popall()); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
do you need both aq and result?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
result is used to make sure all packet (which we pop from result) was in original order. Since template <class C, class L = typename C::Link_link> class SLL doesn't have dequeue method.
iocore/net/QUICNet.cc
Outdated
|
|
||
| new ((ink_dummy_for_new *)quicpc) QUICPollCont(thread->mutex, nh); | ||
|
|
||
| thread->schedule_every(quicpc, -9); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
a int const is better
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sounds reasonable!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I just copy the line from initialize_thread_for_udp_net(). Please update both of them. :-)
| if (vc != nullptr) { | ||
| int isin = ink_atomic_swap(&vc->read.in_enabled_list, 1); | ||
| if (!isin) { | ||
| nh->read_enable_list.push(vc); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
do we need to hold the lock to modify the nh?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
read_enable_list is an atomic queue. so we don't need to hold the nh lock.
iocore/net/P_UnixNet.h
Outdated
| TS_INLINE int | ||
| EventIO::refresh(int e) | ||
| { | ||
| if (fd == NO_FD) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
no sure about this. can we figure out a better way?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
EventIO is a interface for polling system. Because the QUIC Connection does not supported by polling system, I left the hack code here. I can add a new member within EventIO to indicate the situation.
| @@ -575,8 +575,15 @@ EventIO::start(EventLoop l, NetAccept *vc, int events) | |||
| TS_INLINE int | |||
| EventIO::start(EventLoop l, UnixNetVConnection *vc, int events) | |||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
here, http://people.apache.org/~oknet/quic_arch.2017112813.png, pollCont is meant to call back UnixUdpConnection but here it's call back to UnixNetVConnection?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, but currently QCon doesn't inherit from Connection. So we just leave this here.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
And UnixUDPConnection is used to recv socket, it is running in UDP thread.
bcca475 to
3b18ea3
Compare
iocore/net/UnixUDPNet.cc
Outdated
| g_udp_numSendRetries = g_udp_numSendRetries < 0 ? 0 : g_udp_numSendRetries; | ||
|
|
||
| thread->schedule_every(get_UDPPollCont(thread), -9); | ||
| thread->schedule_every(get_UDPPollCont(thread), -UDP_PERIOD); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
-HRTIME_MSECONDS(9) maybe better.
| free(t); | ||
| return EVENT_DONE; | ||
| } | ||
| this->read.enabled = 1; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is a hack now, because no one calls do_io_xxx of QUICNetVC.
Can you add a comment here, so we can complete it later.
| if ((res = nh->startIO(this)) < 0) { | ||
| // FIXME: startIO only return 0 now! what should we do if it failed ? | ||
| } | ||
|
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please add this->read.enabled = 1; at here.
iocore/net/QUICNetVConnection.cc
Outdated
| this->_packet_handler = packet_handler; | ||
| this->_original_quic_connection_id = original_cid; | ||
| this->_quic_connection_id.randomize(); | ||
| this->ep.syscall = false; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Move to QUICNetProcessor::allocate_vc(EThread *t) ?
|
Where are packets in |
|
longInQueue and shortInQueue are useless currently ! It is going to be used for reordering the rtt0 first packet and handshake packet . |
iocore/net/QUICPacketHandler.cc
Outdated
| } | ||
|
|
||
| // Push the packet into QUICPollCont | ||
| udp_packet->data.ptr = vc; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hmm, I'm not so thrilled with having this data member. Do we have other options?
iocore/net/QUICNet.cc
Outdated
|
|
||
| new ((ink_dummy_for_new *)quicpc) QUICPollCont(thread->mutex, nh); | ||
|
|
||
| thread->schedule_every(quicpc, -UDP_PERIOD); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
HRTIME_MSECONDS?
Why are these negative value?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
negative value means quic pc should be inserted into the priority queue. It will be triggered every loop in evensystem.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@maskit yes, the same for DNS, no very intuitive though.
|
Based on @maskit 's suggestion. I introduced a new struct to packet the UDPPacket and QVC, and removed the hack in UDPPacket. |
|
Looks good to me. Please remove WIP label when it's ready. (I assume some of comments from oknet have to be addressed.) |
maskit
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍
oknet
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Next, make the QUICNetVC inherits from RefCountObj, increase the reference count once a QUICPollEvent is created.

Base on @oknet design.
We create QUICPollCont to dispatch UDPacket to different qvc. And NetHandler will callback to qvc handler to process packet.